<?php
class Block_BlkTopProduct extends Zend_View_Helper_Abstract{
    
    public function blkTopProduct() {
        $view = $this->view;
        $db = Zend_Registry::get('connectDb');
//        $db = Zend_Db::factory($adapter, $config);
        $select = $db->select()
                     ->from('products as p', array('id', 'name', 'picture', 'price', 'selloff', 'cat_id'))
                     ->join('product_category as pc', 'pc.id = p.cat_id', array('name as category_name'))
                     ->where('p.status = 1')
                     ->limit(3, 0)
                     ->order('hits DESC');
        $rows = $db->fetchAll($select);
        require_once (BLOCK_PATH . '/BlkTopProduct/default.php');
    }
}